package com.yanqu.road.server.manger.activity.festivalgift;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.server.TempMgr;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.festivalgift.FestivalGiftModule;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;
import com.yanqu.road.server.manger.player.GamePlayerMgr;

import java.util.List;

public class FestivalGiftMgr extends TempMgr {

    @Override
    public boolean init() throws Exception {
        return false;
    }

    @Override
    public boolean reloadConfig() throws Exception {
        return false;
    }

    @Override
    public boolean reloadData() throws Exception {
        return false;
    }

    @Override
    public boolean stop() {
        return false;
    }

    /**
     * 加载活动
     */
    public static void reloadActivityData(){
        getLogger().info("reload FestivalGift Activity start");
        // 活动信息 activityInfo
        List<ActivityInfo> openActivityInfoList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.FestivalGift.getValue());
        if (openActivityInfoList.size() == 0) {
            getLogger().info("no FestivalGift Activity in show time");
            return;
        }
        //获取在线玩家
        List<GamePlayer> gamePlayerList = GamePlayerMgr.getAllOnlinePlayer();
        for (GamePlayer gamePlayer : gamePlayerList) {
            //初始化礼包MAP
            gamePlayer.getModule(FestivalGiftModule.class).initActivityMallMap();
            //同步礼包数据
            List<ActivityInfo> activityList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.FestivalGift.getValue());
            for (ActivityInfo activityInfo : activityList) {
                gamePlayer.getModule(FestivalGiftModule.class).getMallList(activityInfo.getActivityId());
            }
        }
    }
}
